package com.mission.schedule.CommonDialog;

import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.StyleRes;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.ListView;
import android.widget.TextView;

import com.mission.schedule.R;
import com.mission.schedule.activity.NoteTypepxActivity;
import com.mission.schedule.applcation.App;
import com.mission.schedule.bean.NoteTypeBean;
import com.mission.schedule.bean.qd606.NoteTitleDetailBean;
import com.mission.schedule.constants.ShareFile;
import com.mission.schedule.utils.SharedPrefUtil;

import org.w3c.dom.Text;

import java.util.ArrayList;
import java.util.List;

/**
 * 他人清单菜单
 * Created by liwei on 2017/4/18.
 */

public class NoteOtherRightMenuDialog extends Dialog {
    CallBack callBack;


    SharedPrefUtil sharedPrefUtil = null;
    Context context;
    WindowManager windowManager;
    TextView savemyqd;


    public NoteOtherRightMenuDialog(@NonNull final Context context, @StyleRes int themeResId, WindowManager windowManager,boolean yl) {
        super(context, themeResId);
        this.context = context;
        this.windowManager = windowManager;


        setCanceledOnTouchOutside(true);

        View view = LayoutInflater.from(context).inflate(R.layout.dialog_noteother_menu, null);
        setContentView(view);

        savemyqd = (TextView) view.findViewById(R.id.savemyqd);
        if (yl){//来自预览
            savemyqd.setVisibility(View.GONE);
        }

        savemyqd.findViewById(R.id.savemyqd).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                callBack.savemyqd();
                dismiss();
            }
        });

        view.findViewById(R.id.daiban).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                callBack.daiban();
                dismiss();
            }
        });
        view.findViewById(R.id.richeng).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                callBack.richeng();
                dismiss();
            }
        });
        view.findViewById(R.id.send_note).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                callBack.sendnote();
                dismiss();
            }
        });
        view.findViewById(R.id.longimage).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                callBack.longimage();
                dismiss();
            }
        });

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Window window = getWindow();
        WindowManager.LayoutParams params = window.getAttributes();
        window.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL);
        params.width = windowManager.getDefaultDisplay().getWidth() - 30;
        params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
        window.setAttributes(params);

    }

    public void setCallBack(CallBack callBack) {
        this.callBack = callBack;
    }

    public interface CallBack {
        void daiban();
        void richeng();
        void sendnote();
        void longimage();
        void savemyqd();
    }
}
